package main

import (
	"fmt"
	"strings"
)

func main() {
	bmp := MakeAddSuffix(".bmp")
	jpeg := MakeAddSuffix(".jpeg")

	s1 := bmp("张三")
	fmt.Println("bmp() : ", s1)

	s2 := jpeg("张三")
	fmt.Println("jpeg() : ", s2)

}

func MakeAddSuffix(suffix string) func(string) string {
	return func(name string) string {
		if !strings.HasSuffix(name, suffix) {
			return name + suffix
		}
		return name
	}
}
